import Vue from 'vue'
import VueRouter from 'vue-router'

//引入组件，配置路由懒加载
const Home = () => import(/*webpackChunkName:"Login"*/'../views/Home.vue')  
const Books = () => import(/*webpackChunkName:"Books"*/'../views/Books.vue')
const Me = () => import(/*webpackChunkName:"Me"*/'../views/Me.vue')
const Login = () => import(/*webpackChunkName:"Login"*/ '../views/login.vue')
const Register = () => import(/*webpackChunkName:"Register"*/ '../views/register.vue')
const Setup = () => import(/*webpackChunkName:"Setup"*/ '../views/setup.vue')
const Personal = () => import(/*webpackChunkName:"Personal"*/ '../views/me/personal.vue')
const Nonactivated = () => import(/*webpackChunkName:"Nonactivated"*/ '../views/nonactivated.vue')
const Address = () => import(/*webpackChunkName:"Address"*/ '../views/address.vue')
const Add = () => import(/*webpackChunkName:"Add"*/ '../views/add.vue')
const Bookdetail = () => import(/*webpackChunkName:"Bookdetail"*/ '../views/bookdetail.vue')
const Booksearch = () => import(/*webpackChunkName:"Booksearch"*/ '../views/booksearch.vue')
const Trolley = () => import(/*webpackChunkName:"Trolley"*/ '../views/trolley.vue')
const Coupon = () => import(/*webpackChunkName:"Coupon"*/ '../views/coupon.vue')
const Detail = () => import(/*webpackChunkName:"Detail"*/ '../views/Detail.vue')
const Curriculums = () => import(/*webpackChunkName:"Curriculums"*/ '../views/Curriculums.vue')
const Network = () => import(/*webpackChunkName:"Network"*/ '../views/Network.vue')
const Client = () => import(/*webpackChunkName:"Client"*/ '../views/client.vue')

Vue.use(VueRouter)

const routes = [
  {
    path: '/client',
    name: 'Client',
    component: Client,
  },
  {
    path: '/Network',
    name: 'Network',
    component: Network,
  },
  {
    path: '/Curriculums',
    name: 'Curriculums',
    component: Curriculums,
  },
  {
    path: '/Detail',
    name: 'Detail',
    component: Detail,
  },
  {
    path: '/coupon',
    name: 'Coupon',
    component: Coupon,
  },
  {
    path: '/trolley',
    name: 'Trolley',
    component: Trolley,
  },
  {
    path: '/booksearch',
    name: 'Booksearch',
    component: Booksearch,
  },
  {
    path: '/bookdetail/:id',
    name: 'Bookdetail',
    component: Bookdetail,
  },
  //收货地址
  {
    path: '/address',
    name: 'Address',
    component: Address,
  },
  {
    path: '/add',
    name: 'Add',
    component: Add,
  },
  //空状态
  {
    path: '/nonactivated',
    name: 'Nonactivated',
    component: Nonactivated,
  },
  {
  //个人信息
    path: '/personal',
    name: 'Personal',
    component: Personal,
  },
  //设置
  {
    path: '/setup',
    name: 'Setup',
    component: Setup,
  },
  //登录
  {
    path: '/login',
    name: 'Login',
    component: Login,
  },
  //注册
  {
    path: '/register',
    name: 'Register',
    component: Register,

  },
  //首页
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta: {
      title: "星火英语"
    } 
  },
  //书城页
  {
    path: '/books',
    name: 'Books',
    meta: {
      title: "星火英语"
    },
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "books" */ '../views/Books.vue')
  },
  //我的
  {
    path: '/me',
    name: 'Me',
    component: Me,
    meta: {
      title: "我的"
    }
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
